/**

	ESSE CODIGO NAO E' UTILIZADO NO PROGRAMA

**/

#include <PalindromeCheckerOpenMP.hpp>

unsigned PalindromeCheckerOpenMP::check(std::string word, long long *icount) {
	unsigned total(0u);
	int i, j;
	long long myicount(0L);
	bool isPalindrome = true;
	int length = word.length();
	int halfLenght = length>>1;
	#pragma omp parallel for reduction(+:total) reduction(+:myicount) private(j)
	for (i = 0; i < halfLenght; i++) {
		j = length - i - 1;
		if (word[i] != word[j]) isPalindrome = false, myicount++;
		total = total + word[i] + word[j];
		myicount += 5L;
	}

	if (!isPalindrome) total = 0;
	else if (length&1) total += word[halfLenght];
	if(icount) *icount += myicount;
	return total;
}
